<template>
	<div style="width:100%">
		<div id="maindi" style="min-width: 100%;height:280px;"></div>
		
	</div>
</template>

<script>
	import * as echarts from 'echarts';
	export default {
		name:"tubiaof",
		props: ['jieyueliangmsg'],
		  data(){
			  return{
			  	tongjimsg:{},
				datelist:[],
				jielist:[],
				huanlist:[],
			  }
		  },
		  watch:{
			  jieyueliangmsg(oldval,newval){
				  this.getmsg()
			  }
		  },
		  created () {
			
		  },
		  mounted(){
			this.getmsg()
		  },
		  methods:{
			  async getmsg(){
				  this.tongjimsg=this.jieyueliangmsg
				  this.datelist=[]
				  this.jielist=[]
				  this.huanlist=[]
				  for(let item of this.tongjimsg){
					  this.datelist.push(item.name)
					   this.jielist.push(item.jie_num) // 敏感
					   this.huanlist.push(item.huan_num) // 非敏感
				  }
				  console.log( '你好',this.datelist)
				  // this.jiemsg=this.jieyuemsg
				  let that =this
					  setTimeout(res=>{
						  that.getbiao()
					  },500)
					 
				  
				  
			  },
			  getbiao(){
				let a = this.datelist
				let b = this.jielist
				let c = this.huanlist
				
				// let b=this.jiemsg.borrow_zhanbi
				
				  // console.log('这是a',b)
				var myChart = echarts.init(document.getElementById('maindi'));
				var breakCount = [];
				    var checkCount = [];
				    var riskLevelDetails = [];
				    var riskNames = [];
				    var riskIds = [];

				let	 option = {
					color: ['#c23531'],
					tooltip: {
					            trigger: 'axis',
					            axisPointer: { // 坐标轴指示器，坐标轴触发有效
					                type: 'shadow' // 默认为直线，可选为：'line' | 'shadow'
					            },
					            //悬浮提示
					            formatter: function (params) {
					                for (var i = 0, l = option.xAxis.data.length; i < l; i++) {
										
					                    if (option.xAxis.data[i] == params[0].name) {
					                        console.log(params[0])
					                        return params[0].name + '  ' +params[0].data + '条'
					                    }
					                }
					            }
					        },
					
  xAxis: {
    type: 'category',
    data: ['汽车之家', '新浪', '搜狐', '腾讯网', '东方财富网', '今日头条', '西瓜视频']
  },
  yAxis: {
    type: 'value'
  },
  series: [
    {
      data: [1200, 2000, 1500, 4000, 7000, 5100, 4300],
      type: 'bar',
      showBackground: true,
     
    }
  ]
};
				        // 使用刚指定的配置项和数据显示图表。
				        myChart.setOption(option);
			  }
		  },
		
	}
</script>

<style>
</style>